/*
 * Copyright (c) Huawei Technologies Co.,Ltd. 2023. All rights reserved.
 */
package org.opengauss.mapper;

import org.opengauss.vo.DateTimestampVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Title: the DateTimestampMapper interface.
 * <p>
 * Description:
 *
 * @author justbk
 * @version [Tools 0.0.1, 2023/8/18]
 * @since 2023/8/18
 */
public interface DateTimestampMapper {
    @Update("create table if not exists t_date_timestamp(id int, d1 timestamp(0) with time zone, d2 timestamp without time zone)")
    void createTable();
    
    @Update("drop  table if exists t_date_timestamp")
    void dropTable();
    
    int insert(@Param("vo") DateTimestampVo vo);
    
    List<DateTimestampVo> selectAll();
    
    List<DateTimestampVo> selectByVo(@Param("vo") DateTimestampVo vo);
    
    @Select("select case when max(id) is null then 0 else max(id)+1 end as maxId  from t_date_timestamp")
    int selectMaxId();
}
